import { IEnum, IKeyValuePair } from '@/typings';

/**
 * 纯前端在用，没有跟后端的数据交换
 */
export enum SubmitStatusEnum {
    Wait, // 未提交
    Submitted // 已提交
}
/*
<button type="button" :disabled="isDisabled"></button>
<button type="button" :disabled="SubmitStatusEnum.Submitted === btnSumbitStatus"></button>

@click="submitHandler"

btnSumbitStatus: SubmitStatusEnum.Wait

get isDisabled() {
    return btnSumbitStatus === SubmitStatusEnum.Submitted
}

submitHandler() {
    btnSumbitStatus = SubmitStatusEnum.Submitted
}

Vue.prototype.SubmitStatusEnum = SubmitStatusEnum
*/

/**
 * 前后端数据有交换的情况下，post,get,delete,put
 */

interface ITodoEnum extends IKeyValuePair {
    Wait: IEnum,
    Finish: IEnum,
}

export const TodoItemEnum: ITodoEnum = {
  Wait: {
    code: 'Wait',
    description: '待办123213',
  },
  Finish: {
    code: 'Finish',
    description: '已完成',
  },
};
/*
const data = TodoItemEnum['xxx'] as IEnum;
const {code, description} = data;

<span>{{ description }}</span>
 */
